home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / include / necko / nsIStreamTransportService.h < prev    next >
C/C++ Source or Header  |  2006-05-08  |  7KB  |  153 lines

  1. /*
  2.  * DO NOT EDIT.  THIS FILE IS GENERATED FROM nsIStreamTransportService.idl
  3.  */
  4.  
  5. #ifndef __gen_nsIStreamTransportService_h__
  6. #define __gen_nsIStreamTransportService_h__
  7.  
  8.  
  9. #ifndef __gen_nsISupports_h__
  10. #include "nsISupports.h"
  11. #endif
  12.  
  13. /* For IDL files that don't want to include root IDL files. */
  14. #ifndef NS_NO_VTABLE
  15. #define NS_NO_VTABLE
  16. #endif
  17. class nsITransport; /* forward declaration */
  18.  
  19. class nsIInputStream; /* forward declaration */
  20.  
  21. class nsIOutputStream; /* forward declaration */
  22.  
  23.  
  24. /* starting interface:    nsIStreamTransportService */
  25. #define NS_ISTREAMTRANSPORTSERVICE_IID_STR "8268d474-efbf-494f-a152-e8a8616f4e52"
  26.  
  27. #define NS_ISTREAMTRANSPORTSERVICE_IID \
  28.   {0x8268d474, 0xefbf, 0x494f, \
  29.     { 0xa1, 0x52, 0xe8, 0xa8, 0x61, 0x6f, 0x4e, 0x52 }}
  30.  
  31. /**
  32.  * This service read/writes a stream on a background thread.
  33.  *
  34.  * Use this service to transform any blocking stream (e.g., file stream)
  35.  * into a fully asynchronous stream that can be read/written without 
  36.  * blocking the main thread.
  37.  */
  38. class NS_NO_VTABLE nsIStreamTransportService : public nsISupports {
  39.  public: 
  40.  
  41.   NS_DEFINE_STATIC_IID_ACCESSOR(NS_ISTREAMTRANSPORTSERVICE_IID)
  42.  
  43.   /**
  44.      * CreateInputTransport
  45.      *
  46.      * @param aStream
  47.      *        The input stream that will be read on a background thread.
  48.      *        This stream must implement "blocking" stream semantics.
  49.      * @param aStartOffset
  50.      *        The input stream will be read starting from this offset.  Pass
  51.      *        -1 to read from the current stream offset.  NOTE: this parameter
  52.      *        is ignored if the stream does not support nsISeekableStream.
  53.      * @param aReadLimit
  54.      *        This parameter limits the number of bytes that will be read from
  55.      *        the input stream.  Pass -1 to read everything.
  56.      * @param aCloseWhenDone
  57.      *        Specify this flag to have the input stream closed once its
  58.      *        contents have been completely read.
  59.      *
  60.      * @return nsITransport instance.
  61.      */
  62.   /* nsITransport createInputTransport (in nsIInputStream aStream, in long long aStartOffset, in long long aReadLimit, in boolean aCloseWhenDone); */
  63.   NS_IMETHOD CreateInputTransport(nsIInputStream *aStream, PRInt64 aStartOffset, PRInt64 aReadLimit, PRBool aCloseWhenDone, nsITransport **_retval) = 0;
  64.  
  65.   /**
  66.      * CreateOutputTransport
  67.      *
  68.      * @param aStream
  69.      *        The output stream that will be written to on a background thread.
  70.      *        This stream must implement "blocking" stream semantics.
  71.      * @param aStartOffset
  72.      *        The output stream will be written starting at this offset.  Pass
  73.      *        -1 to write to the current stream offset.  NOTE: this parameter
  74.      *        is ignored if the stream does not support nsISeekableStream.
  75.      * @param aWriteLimit
  76.      *        This parameter limits the number of bytes that will be written to
  77.      *        the output stream.  Pass -1 for unlimited writing.
  78.      * @param aCloseWhenDone
  79.      *        Specify this flag to have the output stream closed once its
  80.      *        contents have been completely written.
  81.      *
  82.      * @return nsITransport instance.
  83.      */
  84.   /* nsITransport createOutputTransport (in nsIOutputStream aStream, in long long aStartOffset, in long long aWriteLimit, in boolean aCloseWhenDone); */
  85.   NS_IMETHOD CreateOutputTransport(nsIOutputStream *aStream, PRInt64 aStartOffset, PRInt64 aWriteLimit, PRBool aCloseWhenDone, nsITransport **_retval) = 0;
  86.  
  87. };
  88.  
  89. /* Use this macro when declaring classes that implement this interface. */
  90. #define NS_DECL_NSISTREAMTRANSPORTSERVICE \
  91.   NS_IMETHOD CreateInputTransport(nsIInputStream *aStream, PRInt64 aStartOffset, PRInt64 aReadLimit, PRBool aCloseWhenDone, nsITransport **_retval); \
  92.   NS_IMETHOD CreateOutputTransport(nsIOutputStream *aStream, PRInt64 aStartOffset, PRInt64 aWriteLimit, PRBool aCloseWhenDone, nsITransport **_retval); 
  93.  
  94. /* Use this macro to declare functions that forward the behavior of this interface to another object. */
  95. #define NS_FORWARD_NSISTREAMTRANSPORTSERVICE(_to) \
  96.   NS_IMETHOD CreateInputTransport(nsIInputStream *aStream, PRInt64 aStartOffset, PRInt64 aReadLimit, PRBool aCloseWhenDone, nsITransport **_retval) { return _to CreateInputTransport(aStream, aStartOffset, aReadLimit, aCloseWhenDone, _retval); } \
  97.   NS_IMETHOD CreateOutputTransport(nsIOutputStream *aStream, PRInt64 aStartOffset, PRInt64 aWriteLimit, PRBool aCloseWhenDone, nsITransport **_retval) { return _to CreateOutputTransport(aStream, aStartOffset, aWriteLimit, aCloseWhenDone, _retval); } 
  98.  
  99. /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
  100. #define NS_FORWARD_SAFE_NSISTREAMTRANSPORTSERVICE(_to) \
  101.   NS_IMETHOD CreateInputTransport(nsIInputStream *aStream, PRInt64 aStartOffset, PRInt64 aReadLimit, PRBool aCloseWhenDone, nsITransport **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->CreateInputTransport(aStream, aStartOffset, aReadLimit, aCloseWhenDone, _retval); } \
  102.   NS_IMETHOD CreateOutputTransport(nsIOutputStream *aStream, PRInt64 aStartOffset, PRInt64 aWriteLimit, PRBool aCloseWhenDone, nsITransport **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->CreateOutputTransport(aStream, aStartOffset, aWriteLimit, aCloseWhenDone, _retval); } 
  103.  
  104. #if 0
  105. /* Use the code below as a template for the implementation class for this interface. */
  106.  
  107. /* Header file */
  108. class nsStreamTransportService : public nsIStreamTransportService
  109. {
  110. public:
  111.   NS_DECL_ISUPPORTS
  112.   NS_DECL_NSISTREAMTRANSPORTSERVICE
  113.  
  114.   nsStreamTransportService();
  115.  
  116. private:
  117.   ~nsStreamTransportService();
  118.  
  119. protected:
  120.   /* additional members */
  121. };
  122.  
  123. /* Implementation file */
  124. NS_IMPL_ISUPPORTS1(nsStreamTransportService, nsIStreamTransportService)
  125.  
  126. nsStreamTransportService::nsStreamTransportService()
  127. {
  128.   /* member initializers and constructor code */
  129. }
  130.  
  131. nsStreamTransportService::~nsStreamTransportService()
  132. {
  133.   /* destructor code */
  134. }
  135.  
  136. /* nsITransport createInputTransport (in nsIInputStream aStream, in long long aStartOffset, in long long aReadLimit, in boolean aCloseWhenDone); */
  137. NS_IMETHODIMP nsStreamTransportService::CreateInputTransport(nsIInputStream *aStream, PRInt64 aStartOffset, PRInt64 aReadLimit, PRBool aCloseWhenDone, nsITransport **_retval)
  138. {
  139.     return NS_ERROR_NOT_IMPLEMENTED;
  140. }
  141.  
  142. /* nsITransport createOutputTransport (in nsIOutputStream aStream, in long long aStartOffset, in long long aWriteLimit, in boolean aCloseWhenDone); */
  143. NS_IMETHODIMP nsStreamTransportService::CreateOutputTransport(nsIOutputStream *aStream, PRInt64 aStartOffset, PRInt64 aWriteLimit, PRBool aCloseWhenDone, nsITransport **_retval)
  144. {
  145.     return NS_ERROR_NOT_IMPLEMENTED;
  146. }
  147.  
  148. /* End of implementation class template. */
  149. #endif
  150.  
  151.  
  152. #endif /* __gen_nsIStreamTransportService_h__ */
  153.